﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using GalaSoft.MvvmLight;

namespace BaffoHat.Wpf.ViewModel
{
    public class ViewModel : ViewModelBase
    {
        protected virtual void OnPropertyChanged<T>(Expression<System.Func<T>> property)
        {
            var expression = property.Body as MemberExpression;
            if (expression != null)
            {
                var member = expression.Member;
                var propertyName = member.Name;

                RaisePropertyChanged(propertyName);
            }
            else
            {
                throw new NotSupportedException("Only MemberExpression(s) are supported.");
            }
        }
    }
}
